Xbasic

A5_APPEND_QUICK Function

Syntax

P a5_append_quick(C master_table ,C transaction_table [,C append_type [,C key [,C transaction_filter [,L show_Xbasic [,C fieldmap [,C transactionKey [,L appendUnMappedFields ]]]]]]])

Arguments

master_table

The name of the table to receive the new records.

transaction_table

The name of the table providing the new records.

append_type

Optional Default = "All". Possible values are: "All" = append all records from the Transaction table "Unique" = append only Transaction table records that are unique "Replace" = Transaction table records replace Master table records

key

Optional. The name of the index or query to use to determine record uniqueness.

transaction_filter

Optional. Default = All records. A character filter expression that evaluates to a logical value. Selects records from the Transaction table.

show_Xbasic

Logical. Optional. Default = .F. .T. = Displays the generated Xbasic code when run from the Interactive window, but does not run the append operation. .F. = Runs the append operation..

fieldmap

Character

transactionKey

Character

appendUnMappedFields

Logical

Description

Appends transaction table to master table. Tables must have same field names, unless a fieldmap is supplied. Append_type is "all", "unique", or "replace". Fieldmap is a crlf delimited string. Format is mastertable_fieldname|transactiontable_fieldname. TranscationKey is only needed if fieldnames in master and transaction are not the same.

Discussion

The A5_APPEND_QUICK() function appends the Transaction table to the Master table. Both tables must have the same structure and field names.

Example

This example runs the append operation. The Show_Xbasic flag is .F. .

?a5_append_quick("Vendor", "Vendor2", "All", "Vendor_id", "Vendor_ID > " + quote("V002"), .f.)
= records_appended = "4"
records_total = "4"
records_violated = "0"

This example displays the Xbasic code. The Show_Xbasic flag is .T..

? a5_append_quick("Vendor", "Vendor2", "All", "Vendor_id", "Vendor_ID > " + quote("V002"), .t.)
= flag_error = .F.
Xbasic_code = a_tbl = table.open("c:\databases\expressions test\Vendor.DBF")
append.t_db = "c:\databases\expressions test\Vendor2.DBF"
append.m_key = "Vendor_id"
append.t_key = "Vendor_id"
append.m_filter = ""
append.t_filter = "Vendor_ID > \"V002\""
append.type = "All"
append.m_field1 = "VENDOR_ID"
append.m_exp1 = "@Vendor2->VENDOR_ID"
append.m_field2 = "NAME"
append.m_exp2 = "@Vendor2->NAME"
append.m_field3 = "ADDRESS_1"
append.m_exp3 = "@Vendor2->ADDRESS_1"
append.m_field4 = "ADDRESS_2"
append.m_exp4 = "@Vendor2->ADDRESS_2"
append.m_field5 = "CITY"
append.m_exp5 = "@Vendor2->CITY"
append.m_field6 = "STATE_REGION"
append.m_exp6 = "@Vendor2->STATE_REGION"
append.m_field7 = "POSTAL_CODE"
append.m_exp7 = "@Vendor2->POSTAL_CODE"
append.m_field8 = "COUNTRY"
append.m_exp8 = "@Vendor2->COUNTRY"
append.m_field9 = "PHONE"
append.m_exp9 = "@Vendor2->PHONE"
append.m_field10 = "FAX"
append.m_exp10 = "@Vendor2->FAX"
append.m_field11 = "CONTACT_NAME"
append.m_exp11 = "@Vendor2->CONTACT_NAME"
append.m_count = 11
append.t_count = 0
a_tbl.append()

See Also